-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache packages to CacheDir #68
base: main
Are you sure you want to change the base?
Conversation
aurget
Outdated
@@ -333,6 +344,7 @@ set_defaults() { | |||
sync_mode='install' | |||
temp_directory='/tmp/aurget' | |||
user_config="${XDG_CONFIG_HOME:-$HOME/.config}/aurgetrc" | |||
pkg_cache_dir=$((grep -m 1 '^CacheDir' /etc/pacman.conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir = //') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg_cache_dir=$((grep -m 1 '^CacheDir' /etc/pacman.conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir = //') | |
pkg_cache_dir=$(sed '/^CacheDir *=[^ ]*\(.*\)$/\1/' /etc/pacman.conf) | |
pkg_cache_dir=${pkg_cache_dir:-/var/cache/pacman/pkg} |
I forget, do we intend to respect a PACMAN_CONF
environment variable? We might need to, if we want to test this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a PACMAN_CONF env variable and I couldn't find any mention on pacman.conf man page either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this would be something we'd invent for our own use case, to make this configurable. It's not a super compelling use-case but it makes it much easier to test.
This code LGTM but I think it should be opt-in behind a flag and config option, it could be surprising to just start happening. WDYT? |
Maybe also have a look at the two |
@@ -333,6 +349,8 @@ set_defaults() { | |||
sync_mode='install' | |||
temp_directory='/tmp/aurget' | |||
user_config="${XDG_CONFIG_HOME:-$HOME/.config}/aurgetrc" | |||
pkg_cache_dir=$(sed -n 's/^CacheDir[ \t]*\=[ \t]*//p' /etc/pacman.conf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redirect error to /dev/null; default path defined later
pkg_cache_dir=$(sed -n 's/^CacheDir[ \t]=[ \t]//p' /etc/pacman.conf 2>/dev/null)
Related to #60.
Caches the made packages to CacheDir as defined in pacman.conf.